package com.lt.experiment05.mission01;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author LT
 * @version 1.0
 * @PackageName com.lt.experiment05.mission01
 * @ClassName Test
 * @Description to do
 * @date 2021/11/16 11:08
 */
public class Test {
    public static void main(String[] args) {
        List<Menu> menus = new ArrayList<Menu>();
        menus.add(new Menu(1.1,"家常菜","主营家常菜"));
        menus.add(new Menu(2.1,"火锅","主营火锅"));
        menus.add(new Menu(1.2,"烧烤","主营烧烤"));
        menus.add(new Menu(3.1,"自助","主营自助"));
        menus.add(new Menu(1.3,"小卖部","主营小卖部"));
        Abstractlterator lterator;
        AbstractObjectList list;

        list = new MenuList(menus);
        lterator  = list.createIterator();
        while (lterator.hasNext()){
            System.out.println((lterator.currentItem())+",");
            lterator.next();
        }

/*      ---List自带的迭代器---
        Iterator<Menu> iterator = menus.iterator();
        while (iterator.hasNext()){
            Menu next = iterator.next();
            System.out.println(next);
        }
        ---foreach---
        for (Menu menu : menus) {
            System.out.println(menu.toString());
        }*/
    }
}
